home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / graphics / imageengineerv1.1 / arexx / makeiconmwb.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-04-11  |  1.7 KB  |  67 lines

  1. /* Image Engineer ARexx macro script           */
  2. /* by Simon Edwards                            */
  3. /* 4/4/95                                      */
  4. /* MakeIconMWB V1.0 (same as MakeIcon except   */
  5. /* uses MagicWB.palette.                       */
  6. /*                                             */
  7. /* Renders an icon of an image and saves it to */
  8. /* the clipboard for pasting into IconEdit.    */
  9.  
  10. Options results
  11. signal on error            /* Setup a place for errors to go */
  12.  
  13. if arg()==0 then exit
  14.  
  15. PROJECT_INFO arg(1) WIDTH
  16. ImageWidth=RESULT
  17. PROJECT_INFO arg(1) HEIGHT
  18. ImageHeight=RESULT
  19.  
  20. if ImageWidth/ImageHeight>2.0 then
  21.     do
  22.     NewWidth=80
  23.     NewHeight=ImageHeight*80.0/ImageWidth
  24.     end
  25. else
  26.     do
  27.     NewWidth=ImageWidth*40.0/ImageHeight
  28.     NewHeight=40
  29.     end
  30.  
  31. SCALE arg(1) NewWidth NewHeight BEST
  32. icon=RESULT
  33. 'LOAD_PALETTE' icon '"IE:palettes/magic.palette"'
  34. RENDER_DEPTH icon 8
  35. RENDER_COLOURS icon 8
  36. RENDER_DEVICE icon AMIGA
  37. RENDER_DITHER icon FLOYD
  38.  
  39. PROJECT_INFO icon TYPE
  40. if RESULT=='GREY' then
  41.     RENDER_QUANTIZE icon LOCK
  42. else
  43.     RENDER_QUANTIZE icon LOCK_BEST
  44. RENDER icon
  45. SAVE_CLIP icon
  46. CLOSE icon
  47.  
  48. exit
  49.  
  50. /*******************************************************************/
  51. /* This is where control goes when an error code is returned by IE */
  52. /* It puts up a message saying what happened and on which line     */
  53. /*******************************************************************/
  54. error:
  55. if RC=5 then do            /* Did the user just cancel us? */
  56.     IE_TO_FRONT
  57.     LAST_ERROR
  58.     'REQUEST "'||RESULT||'"'
  59.     exit
  60. end
  61. else do
  62.     IE_TO_FRONT
  63.     LAST_ERROR
  64.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  65.     exit
  66. end
  67.